#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
PyCron - Windows定时任务调度器
一个简单灵活的定时任务软件，支持cron配置，能够在Windows后台运行
"""

__version__ = "1.0.0"
__author__ = "PyCron Team"
__description__ = "Windows定时任务调度器，支持cron表达式"

# 导入主要模块
from .cron_parser import CronParser, validate_cron_expression, get_cron_examples
from .task_scheduler import TaskScheduler, ScheduledTask, TaskStatus
from .config_manager import ConfigManager
from .windows_service import CronPySchedulerService, ServiceManager
from .cli import cli

# 便捷函数
def create_scheduler(config_dir="config", **kwargs):
    """创建调度器实例"""
    config_manager = ConfigManager(config_dir)
    scheduler_config = config_manager.get_scheduler_config()
    scheduler_config.update(kwargs)

    scheduler = TaskScheduler(**scheduler_config)

    # 加载任务
    tasks = config_manager.load_all_tasks()
    for task in tasks:
        scheduler.add_task(task)

    return scheduler


def main():
    """主入口函数"""
    cli()


if __name__ == "__main__":
    main()
